package com.nectech.entity;

import com.nectech.client.MapleStoryClient;
import com.nectech.util.ImageUtil;

import java.awt.*;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @Author: 浅小北
 * @ClassName: PropPackage
 * @Description: 道具包类
 * @Date: 2021/1/29 19:24
 * @Since: version-1.0
 */
public class PropPackage extends AbstractMapleStoryObject{
    public Image image;
    public MapleStoryClient msc;
    public List<Prop> props = new CopyOnWriteArrayList<>();
    public PropPackage() {
        this.x = 1300;
        this.y = 200;
    }
    public PropPackage(MapleStoryClient msc) {
        this();
        this.msc = msc;
        this.image = ImageUtil.getImage("propPackage");
        this.live = false;
    }
     /**
      * @Author: 浅小北
      * @Description: 道具包draw方法的重写 
      * @Date: 9:25 2021/1/30
      * @Param: 
      * @return: 
      */
    @Override
    public void draw(Graphics g) {
        if (live) {
            g.drawImage(image,x,y,null);
            for (int i = 0; i < props.size(); i++) {
                Prop prop = props.get(i);
                g.drawImage(prop.img,x + (i * 40) + 7,y + prop.height * 2,null);
                g.drawString(prop.quantity + "",x + (i * 40) + 7,y + 30 +prop.height * 2);
            }
        }
    }
}
